﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Bootstrap5.Abstractions;

using Microsoft.AspNetCore.Components;

namespace Bootstrap5;

/// <summary>
/// 表示一个容器，支持自适应。
/// </summary>
[HtmlTag("div")]
public class Container : BootstrapChildContentComponentBase
{
    /// <summary>
    /// 全宽容器，跨越视口的整个宽度。
    /// </summary>
    [Parameter]public bool Fluid { get; set; }
    /// <summary>
    /// 响应式断点。
    /// </summary>
    [Parameter] public BreakPoint? BreakPoint { get; set; }

    protected override void CreateCssClass(ICssClassBuilder builder)
    {
        if (Fluid)
        {
            builder.Add("container-fluid");
        }
        else if(BreakPoint.HasValue)
        {
            builder.Add($"container-{BreakPoint.Value.GetEnumCssClass()}");
        }
        else
        {
            builder.Add("container");
        }
    }
}
